package com.cy.核心编程.thead.basic.dead;

public class DeadLock2 extends Thread{
    @Override
    public void run() {
        synchronized (ResourseObject.obj2){
            System.out.println("锁定第2个资源");
            try {
                Thread.sleep(1);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
            synchronized (ResourseObject.obj1){
                System.out.println("锁定第1个资源");
                System.out.println("执行完毕");
            }
        }
    }
}
